<script setup>
import { tagGetService } from '@/api/tag'
import { ref } from 'vue'

defineProps({
  modelValue: {
    type: [Number, String]
  },
  width: {
    type: String
  }
})
const emit = defineEmits(['update:modelValue'])
const cityTagList = ref([])
const getTagList = async () => {
  const res = await tagGetService()
  cityTagList.value = res.data.data
  console.log(res.data.data)
}
getTagList()
</script>

<template>
  <!-- label 展示给用户看的，value 收集起来提交给后台的 -->
  <el-select
    :modelValue="modelValue"
    @update:modelValue="emit('update:modelValue', $event)"
    :style="{ width }"
  >
    <el-option
      v-for="tag in cityTagList"
      :key="tag.id"
      :label="tag.tagName"
      :value="tag.id"
    ></el-option>
  </el-select>
</template>
